<template>
  <div>
    <div class="card p-3 bg-white mt-3">
      <div class="pb-3 d-flex ai-center" :class="{cardHeader: !img}">
        <i class="iconfont" :class="`icon-${icon}`"></i>
        <div class="fs-xl flex-grow-1 px-1">{{title}}</div>
        <i class="iconfont icon-menu1" v-if="!plain"></i>
      </div>
      <img :src="img" v-if="img" class="pt-2 pb-3 cardHeader img-1">
      <div class="card-body pt-3">
        <!-- 定义插槽 -->
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: { type: String, required: true },
    icon: { type: String, required: true },
    plain: { type: Boolean },
    img: { type: String }
  }
}
</script>

<style lang="scss">
.card {
  .cardHeader {
    border-bottom: 1px solid #d4d9de;
  }
  border-bottom: 1px solid #d4d9de;
  .img-1 {
    width: 100%;
  }
}
</style>
